package com.deyuanyun.pic.ctrl.enumeration;

import com.deyuanyun.pic.ctrl.annotation.AutoEnum;

/**
 * 缺陷维修状态
 * @author lijun
 * @date 2016-06-22
 * 
 * History: 王敏，16/9/12 添加注解，导入时使用
 *History: 王敏，16/11/15 将待修复，改成未修复
 *
 */


@AutoEnum(name="修复状态",method = "getVal")
public enum RepairStateEnum {
    WAIT_FOR_REPAIR("未修复"),
    MAINTENANCE("修复中"),
    DIFFICULT_TO_REPAIR("难以修复"),
    ALREADY_REPAIR("已修复");

    private String label;

    private RepairStateEnum(String label) {
        this.label = label;
    }

    public String getLabel() {
        return label;
    }

    public static String getVal(String lable)
    {

        RepairStateEnum  rs[]=RepairStateEnum.values();
        for(int i=0,end=rs.length;i<end;i++)
        {
            if(rs[i].getLabel().equals(lable))
            {
                return rs[i].toString();
            }
        }
        return null;
    }

    public static String getLabel(String code) {
        RepairStateEnum rs[] = RepairStateEnum.values();
        for (int i = 0; i < rs.length; i++) {
            if (rs[i].toString().equals(code)) {
                return rs[i].getLabel();
            }
        }
        return null;
    }
}
